/**
 */
package de.nordakademie.hausarbeit.stylesheet.impl;

import de.nordakademie.hausarbeit.stylesheet.Color;
import de.nordakademie.hausarbeit.stylesheet.Font;
import de.nordakademie.hausarbeit.stylesheet.StylesheetPackage;
import de.nordakademie.hausarbeit.stylesheet.Text;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Text</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.nordakademie.hausarbeit.stylesheet.impl.TextImpl#getColor <em>Color</em>}</li>
 *   <li>{@link de.nordakademie.hausarbeit.stylesheet.impl.TextImpl#getFont <em>Font</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TextImpl extends BodyImpl implements Text
{
  /**
   * The cached value of the '{@link #getColor() <em>Color</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getColor()
   * @generated
   * @ordered
   */
  protected Color color;

  /**
   * The cached value of the '{@link #getFont() <em>Font</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFont()
   * @generated
   * @ordered
   */
  protected Font font;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected TextImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return StylesheetPackage.Literals.TEXT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Color getColor()
  {
    if (color != null && color.eIsProxy())
    {
      InternalEObject oldColor = (InternalEObject)color;
      color = (Color)eResolveProxy(oldColor);
      if (color != oldColor)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, StylesheetPackage.TEXT__COLOR, oldColor, color));
      }
    }
    return color;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Color basicGetColor()
  {
    return color;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setColor(Color newColor)
  {
    Color oldColor = color;
    color = newColor;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, StylesheetPackage.TEXT__COLOR, oldColor, color));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Font getFont()
  {
    if (font != null && font.eIsProxy())
    {
      InternalEObject oldFont = (InternalEObject)font;
      font = (Font)eResolveProxy(oldFont);
      if (font != oldFont)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, StylesheetPackage.TEXT__FONT, oldFont, font));
      }
    }
    return font;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Font basicGetFont()
  {
    return font;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setFont(Font newFont)
  {
    Font oldFont = font;
    font = newFont;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, StylesheetPackage.TEXT__FONT, oldFont, font));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case StylesheetPackage.TEXT__COLOR:
        if (resolve) return getColor();
        return basicGetColor();
      case StylesheetPackage.TEXT__FONT:
        if (resolve) return getFont();
        return basicGetFont();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case StylesheetPackage.TEXT__COLOR:
        setColor((Color)newValue);
        return;
      case StylesheetPackage.TEXT__FONT:
        setFont((Font)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case StylesheetPackage.TEXT__COLOR:
        setColor((Color)null);
        return;
      case StylesheetPackage.TEXT__FONT:
        setFont((Font)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case StylesheetPackage.TEXT__COLOR:
        return color != null;
      case StylesheetPackage.TEXT__FONT:
        return font != null;
    }
    return super.eIsSet(featureID);
  }

} //TextImpl
